package Core.GameServer;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

class ServerThread extends Thread {
	private final Socket socket;

	public ServerThread(Socket socket) {
		this.socket = socket;
		start();
	}

	public void run() {
		try {
			ObjectOutputStream out = new ObjectOutputStream(
					socket.getOutputStream());
			ObjectInputStream in = new ObjectInputStream(
					socket.getInputStream());
			while (true) {
				in.readObject();
				out.writeObject(new String("test"));
				out.flush();
				out.reset();
			}
		} catch (Throwable t) {
			System.out.println("Caught " + t + " - closing thread");
		}
	}
}